﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MicroBenchmarks.ExternalClass
{
    public class SecondaryClass
    {
        int count;
        int[] elements;
        int currentPosition;

        public SecondaryClass()
        {
            elements = new int[20];
            currentPosition = 0;
            count = 0;
        }
        public void Push(int i)
        {
            if (currentPosition >= 20)
                throw new Exception("Stack full");
            elements[currentPosition++] = i;
            count++;
        }

        public int Pop()
        {
            if (currentPosition == 0)
                throw new Exception("Stack empty");
            count--;
            return elements[--currentPosition];
        }
        
        public int Size()
        {
            return count;
        }
    }
}
